#ifndef ANALYSIS_FOR_FOURBIT_H_H
#define ANALYSIS_FOR_FOURBIT_H_H

#include "intersection_set.h"

typedef struct gue_value 
{
	word e_value ;
	int count ;
}guess_value;

typedef struct gue_array  
{
	guess_value guess_array[ARRAY_MAX*4] ;
	int length ; 
}guess_list;

void initial_guess_list( guess_list*& list ) ;
void destroy_guess_list( guess_list*& list ) ;
int is_guess_list_empty( guess_list* list ) ;
int guess_list_length( guess_list* list ) ;
int is_guess_list_full( guess_list* list ) ;
int is_guess_value_appear( guess_list* list , word element ) ;
int insert_guess_list( guess_list*& list , word element ) ;
void display_guess_list( guess_list* list ) ;

typedef struct pos_list 
{
	word possible_num[ARRAY_MAX*4] ;
	int length ;
}possible_list ;

void initial_possible_list( possible_list*& list ) ;
void destroy_possible_list( possible_list*& list ) ;
int is_possible_list_empty( possible_list* list ) ;
int possible_list_length( possible_list* list ) ;
int is_possible_list_full( possible_list* list ) ;
int is_possible_list_appear( possible_list* list , word element ) ;
int insert_possible_list( possible_list*& list , word element ) ;
void display_possible_list( possible_list* list ) ;
void get_most_list( guess_list* list , intersectionset* most_list ) ;
void get_possible_list_intersection( possible_list* a_list , intersectionset* b_list ) ;

word f_function( word four_bit ) ;
word xor_function( word left_part , word right_part ) ;
void sub_function( word left_part , word right_part , borrow_bit low , word add , borrow_bit& high , word& sub_result ) ;
word sub_error( word left_part , word right_part , int size ) ;
word get_original_dif( word original_dif , int shift_num ) ;
borrow_bit xor_borrow_bit( word xor_dif ) ;
//void differential_f( word original_dif_a , int shiftnum , intersectionset* list ) ;
void differential_f( word insert_error , word original_dif_b , int shiftnum , intersectionset* list ) ;
//void analysis_a( word insert_error , possible_list* list , word original_dif_a , word original_dif_b , int shiftnum , possible_list* b_list ) ;
//void analysis_for_next_fourbit( intersectionset* fourbit , word insert_error , word original_dif_b , int shiftnum , intersectionset* nextfour ) ;

#endif